package com.example.kotlinstudy.ui.main

import com.google.gson.Gson


//数据类
data class LoginBean(
    val code: String,
    val `data`: Data,
    val msg: String,
    val status: String
)

data class Data(
    val companyList: List<Company>,
    val token: String
)

data class Company(
    val companyFullName: String,
    val companyFullNameEn: String,
    val companyId: String,
    val companyName: String,
    val compnayNameEn: String,
    val h5Url: String,
    val imUrl: String,
    val logoPath: String,
    val webUrl: String,
    val webUrlPc: String
)

fun main() {

    //fastjson解析数据类
    val content =
        "{\"code\":\"1\",\"data\":{\"token\":\"1000\",\"companyList\":[{\"companyFullName\":\"伟博思\"}]}}"
//    val loginBean: LoginBean = JSONObject.parseObject(content, LoginBean::class.java)
    val loginBean: LoginBean = Gson().fromJson(content, LoginBean::class.java)
    println(loginBean)
}